package com.wjc.wiki.service;

import com.wjc.wiki.websocket.WebSocketServer;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//ws服务层
@Service
public class WsService {
    @Resource
    private WebSocketServer webSocketServer;

    //启用异步化
    @Async
    public void sendInfo(String info,String logId){
        //将日志流水号输入到当前线程
        MDC.put("LOG_ID",logId);
        webSocketServer.sendInfo(info);
    }
}
